package com.tcs.email.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.tcs.email.queue.QueueUtil;
import com.tcs.model.email.MailSenderInfo;
import com.tcs.rpc.service.IEmailService;

/**
 * v0.1 dubbo 接受数据
 * @version 0.1
 * @deprecated
 * ----------------------------------------------------------------------
 * @serial v0.2 此接口不在使用,v0.1版本使用kafka接口
 * @see v0.2 新的接口  com.tsc.email.message.MessageLogService
 * @Time v0.2 2018年10月15日 22:51:07
 * @version 0.2
 * @author 神经刀
 */
public class IEmailServiceImpl implements IEmailService {
	
	private final Logger logger = LoggerFactory.getLogger(IEmailServiceImpl.class);
	
	@Override
	public void send(MailSenderInfo mailSenderInfo) {
		logger.info(" 接收到数据 monitoringInfo : {} " , mailSenderInfo);
		try {
			if (!QueueUtil.SINGLEING.getQueue().offer(mailSenderInfo)) {
				QueueUtil.SINGLEING.getQueue().put(mailSenderInfo);
			}
		} catch (InterruptedException e) {
			logger.error("" , e);
		} finally {
			logger.debug(" 队列深度 : {}" , QueueUtil.SINGLEING.getQueue().size());
		}
	}

}